import 'package:cgvc/basis/basis_refresh_list_view_model.dart';
import 'package:cgvc/data/article_repository.dart';
import 'package:cgvc/model/article_model.dart';

class ArticleViewModel extends BasisRefreshListViewModel {
  String lastCursor;
  String url;
  ArticleViewModel(this.url);
  @override
  Future<List<ArticleItemModel>> loadData({int pageNum}) async {
    lastCursor = pageNum == 0 ? null : lastCursor;
    ArticleModel model = await ArticleRepository.getArticleList(
      url,
      lastCursor: lastCursor,
      pageSize: pageSize,
    );
    lastCursor = model.getLastCursor();
    return model.data;
  }
}
